
import {postGiveALike} from  '@/request/actions'
import Vue from 'vue'


export default Vue.extend({
          
        methods:{
            like(userInfo:BaseUserInfo,giveId?:string|number):any{

                let pages = getCurrentPages();
                let route = pages[pages.length - 1].route;
               
               

                        if(Object.keys(userInfo).length == 0){
                            return  new Promise((resolve,reject)=>{
                                return uni.showModal({
                                        content:'请先登录',
                                        success:(res:any)=>{
                                            if (res.confirm) {
                                                uni.navigateTo({
                                                    url: `/pages/login/index`
                                                });
                                            }
                                        }
        
                                })

                            })
                            
                        }


                        let {userId} = userInfo;
                    

                       return postGiveALike({userId,giveId})
               }

        }
            
        

})